package org.NooLab.itexx.app.gui.handlers;

import java.awt.Color;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToolBar;

import org.NooLab.itexx.ITexxWindowIntf;
//import org.NooLab.itexx.app.gui.GuiWorker;
import org.NooLab.itexx.app.gui.definition.ITexxWindowGui;
import org.NooLab.itexx.app.gui.definition.ITexxWindowGuiIntf;
import org.NooLab.itexx.browser.BrowserWorker;


import com.sun.jna.examples.WindowUtils;




/*
 * screen handling (fullscreen) 
 * https://tvbrowser.svn.sourceforge.net/svnroot/tvbrowser/trunk/tvbrowser/src/tvbrowser/ui/mainframe/MainFrame.java
 * 
 * this object gets distributed via ITexxWindowCommons, it is created either there, or in windowGui
 * 
 */
public class WindowAppearance implements  WindowAppearanceIntf {

	boolean simpleView = false;
	ITexxWindowGuiIntf windowGui;
	private JPanel panelFoundTab;
	private JPanel panelFound;
	private JPanel panelTop;
	private JToolBar toolBar;
	private JPanel contentPanel;
	private ITexxWindowIntf app;
	JFrame frame ;
	
	// ========================================================================
	public WindowAppearance(ITexxWindowGuiIntf windowgui){
		windowGui = windowgui;
		app = windowGui.getTexxWindowApp();
		frame = app.getMainFrame();
	}
	// ========================================================================

	public void toggleSimpleView() {
		JFrame frame = app.getMainFrame();
		boolean hb = frame.isUndecorated();
		
		toggleSimpleView(hb);
		
	}
	public void toggleSimpleView(boolean isSimple) {
		/*
		 * PanelFound
		 * topPanel  <-> jPanelFoundTab
		 * 
		 */

	
		panelFound = windowGui.getPanelFound();
		panelFoundTab = windowGui.getPanelFoundTab();
		panelTop = windowGui.getTopPanel();
		toolBar = windowGui.getMainToolBar();
		contentPanel = windowGui.getContentPanel(); 
		
		
		if (simpleView ){
			// now going to decorated view 
			/*
			windowGui.getTopPanel().setOpaque(false);
			windowGui.getContentPanel().setOpaque(false);
			
			
			panelFoundTab.remove(panelFound);
			panelTop.add(panelFound); // wrong reference, we need the status bar ??
			// contentPanel.add(panelFound); 
			toolBar.setVisible( false);
			contentPanel.setVisible(false);
			
			// frame.getContentPane().setBackground(new Color(0.1f,0.1f,0.1f,0.1f));
			
			windowGui.getTopPanel().setOpaque(true);
			windowGui.getContentPanel().setOpaque(true);
		
			windowGui.getTopPanel().setVisible(true);
			boolean framedecor = true;
			*/


		}else{

			simpleView = true;
		}   
		
		
		
	}
	
	@Override
	public void prepareSimpleView(int target) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void toggleSimpleView(int target) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public ITexxWindowGuiIntf getWindowGui() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addComponent(JComponent component, int mode, float... values) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void perform(int value) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void clearResultList(int parameter) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void exitApplication() {
		// TODO Auto-generated method stub
		
	}
}
